# # """
# 123
# 456
#
#
# # 数字字面量
# print(666)
# #浮点数字面量
# print(13.14)
# print("我爱python")
#
# #变量名=变量值
# money=50;
# print("钱包还有",money)
# money=money-10
# print(money)
#
# from tokenize import String
#
# print(type("123"))
#
# String_type =type("heima")
# print(String_type)
#
# name="heima"
# name_type=type(name)
# print(name_type)
#
# num_str=str(11)
# print(type(num_str),num_str)
#
# name = ' "123 " '
# name = " '123'  "
# name ="\"123\""
# name ='   \'123\'  '
#
# name="黑马程序员"
# message="学IT就来 %s" % name
# print(message)
#
# num1= 123
# num2= 456
# message="数字一是%s数字二是%s"%(num1,num2)
# print(message)
#
# num1 =11
# num2=11.345
# print("数字11宽度限制5，结果是：%5d" % num1)
# print("数字11宽度限制1，结果是：%1d" % num1)
# print("数字11.345宽度限制7，小数精度2，结果是：%7.2f" % num2)
# print("数字11.345不限制，小数精度2，结果是：%7.2f" % num2)
#
# print("1*1的结果是:%d" % (1*1))
# print("1*2的结果是:{1*2}")
# print("字符串在python中的类型名是：%s"% type("字符串"))
#
# name="传播博客"
# stock_price=19.99
# stock_code= "00302"
# stock_price_daily_growth_factor=1.2
# growth_days=7
# now=stock_price*stock_price_daily_growth_factor**growth_days
# print(f"{name,stock_code,stock_price}")
# print("%.1f,%d,%.2f" % (stock_price_daily_growth_factor,growth_days,now))
#
# print("输入一个数字")
# num=input()
# print("数字是%s" % num)
#
# num2=input(("输入一个数字"))
# print("数字是%s" % num2)
#
# result1=10>5
# print(f"10>5结果是：{result1},类型是{type(result1)}")
#
# result2="cao"=="jiajia"
# print(f"字符串cao是否和jiajia相等，结果是：{result2},类型是：{type(result2)}")
#
# my_age=18
# if my_age>=18:
#     print("我已经成年了")
#
# i=0
# while i<100:
#    print("我爱python")
#    i+=1
#
# #求1-100的和
# i=1
# sum=0
# while i<=100:
#     sum+=i
#     i+=1
# print(sum)
#
# #猜数字
# import random
#
# from sympy import false
#
# num1=random.randint(1,100)
#
# flag=True
# while flag:
#     num2 = int(input("请输入一个数字"))
#     if num1==num2:
#         flag = False
#         print("恭喜猜对啦")
#     elif(num1>num2):
#         print("小了")
#     elif num2>num1:
#         print("大了")
#
# i=1
# while i<=100:
#     print(f"喜欢python的第{i}天......")
#     j=1
#     while j<=12:
#         print(f"学习python的第{j}小时")
#         j+=1
#     print("继续加油")
#     i+=1
# print(f"坚持到第{i-1}天，学会python")
#
# print("Hello",end='')
# print("World",end='')
#
# #九九乘法表
# i=1
# while i<=9:
#     j=1
#     while j<=i:
#         print(f"{j}*{i}={j*i}\t",end='')
#         j+=1
#     i+=1
#     print()
#
# #定义字符串name
# name="jiajia"
# #for循环处理字符串
# for x in name:
#     print(x)
#
# i=0
# name="jiajia is a perfect girl"
# for x in name:
#     if x=="a":
#         i+=1
#
# print(i)
#
# for x in range(1,10,2):
#     print(x)
#
# for x in range(5):
#     print("五周年我必有票")
# """
# #from xarray.core.computation import result_name
#
#
# # 1~100有几个偶数
# # num=100
# # i=0
# # for x in range(1,num):
# #    if x%2==0:
# #        i+=1
# # print(i)
#
#
# # i=1
# # for i in range (1,101):
# #     print(f"喜欢python的第{i}天，加油")
# #     for j in range (1,10):
# #         print(f"学习python的第{j}小时")
# #     print(f"第{i}天学习结束")
# # print(f"热爱坚持到了第{i}天")
#
#
# #  九九乘法表
# # for i in range(1,10):
# #     for j in range (1,i+1):
# #         print(f"{j}*{i}={j*i}\t",end='')
# #     # 外层循环可以通过print输出一个回车符
# #     print()
#
#
# # def add(x, y):
# #     result = x + y
# #     print(f"{x}+{y}的结果为{result}")
# #
# # add(2,3)
# # """
# # None用于if判断
# # def check_age(age):
# #     if age>18:
# #         return "SUCCESS"
# #     else:
# #         return None
# #
# # result=check_age(16)
# # if not result:
# #     # 进入if表示result是None值 也就是False
# #     print("未成年禁止进入")
#
# num=100
#
# def test_a():
#     print(f"test_a:{num}")
#
# def test_b():
#     # global 关键字声明a是全局变量
#     global num
#     num=200
#     print(f"test_b:{num}")
#
# test_a()
# test_b()
# print(num)

# 综合案例 ：黑马ATM
"""
·定义一个全局变量：money，用来记录银行卡余额（默认5000000）
·定义一个全局变量：name，用来记录客户姓名（启动程序时输入）
·定义如下的函数：
    ·查询余额函数  ·存款函数  ·取款函数   ·主菜单函数
·要求：
·程序启动后要求输入客户姓名   ·查询余额、存款、取款后都会返回主菜单   ·存款、取款后，都应显示一下当前余额
·客户选择退出或输入错误，程序会退出，否则一直运行
"""
# #my_solution
# money=5000000
# name=(input("请输入您的姓名"))
# flag=True
#
#
# def func_1():
#     print(f"{name}余额剩余{money}元")
#
# def func_2():
#     print(f"{name}存款{money}元成功")
#
# def func_3():
#     print(f"{name}取款{money}元成功")
#
# def func_4():
#     print(f"{name}您已成功退出")
# while flag:
#     num=(input(f"{name}您好，请选择操作：1、查询余额 2、存款 3、取款 4、退出"))
#     if num=="1":
#         func_1()
#     elif num=="2":
#         func_2()
#     elif num=="3":
#         func_3()
#     else:
#         func_4()
#         flag=False

#standard_solution
money=5000000
name=None
name=input("请输入姓名")

def query(show_header):
    if show_header:
        print("-----------查询余额----------")
    print(f"{name}余额剩余{money}元")

def saving(num):
    global money
    money+=num
    print(f"{name}存款{num}元成功")

    query(False)

def get_money(num):
    global money
    money-=num
    print(f"{name}取款{num}元成功")

    query(False)

def main():
    print(f"{name}您好，请选择操作：1、查询余额 2、存款 3、取款 4、退出")

    return input("请输入您的选择：")

while True:
    keyboard_input=main()
    if keyboard_input=="1":
        query(True)
        continue  #通过continue继续下一次循环，一进来就是回到了主菜单
    elif keyboard_input=="2":
        num = int(input("请输入存款数"))
        saving(num)
        continue
    elif keyboard_input=="3":
        num = int(input("请输入取款数"))
        get_money(num)
        continue
    else:
        print("退出")
        break










